package org.infodavid.common.persistence;

import javax.persistence.PersistenceException;

/**
 * The Interface ITransaction.
 */
public interface ITransaction {
  /** User transaction jndi. */
  String USER_TRANSACTION_JNDI = "UserTransaction";

  /** User transaction manager jndi. */
  String TRANSACTION_MANAGER_JNDI = "TransactionManager";

  /**
   * Begin.
   * @throws PersistenceException the persistence exception
   */
  void begin() throws PersistenceException;

  /**
   * Commit.
   * @throws PersistenceException the persistence exception
   */
  void commit() throws PersistenceException;

  /**
   * Rollback.
   * @throws PersistenceException the persistence exception
   */
  void rollback() throws PersistenceException;

  /**
   * Checks if is active.
   * @return true, if checks if is active
   * @throws PersistenceException the persistence exception
   */
  boolean isActive() throws PersistenceException;
}
